package com.haoshuang.zhouzhoubang.ui.dialog

import android.content.Context
import com.blankj.utilcode.util.ScreenUtils
import com.blankj.utilcode.util.SizeUtils
import com.haoshuang.zhouzhoubang.R
import com.haoshuang.zhouzhoubang.databinding.DialogPermissionTipBinding
import com.lxj.xpopup.core.PositionPopupView

/**
 * 权限申请提示弹窗
 * @property title String 指定申请权限
 * @property content String 申请权限的理由
 * @property binding DialogPermissionTipBinding
 * @constructor
 */
class PermissionTipDialog(
    context: Context,
    private val title: String,
    private val content: String,
) : PositionPopupView(context) {

    private lateinit var binding: DialogPermissionTipBinding

    override fun getImplLayoutId(): Int {
        return R.layout.dialog_permission_tip
    }

    override fun onCreate() {
        super.onCreate()
        binding = DialogPermissionTipBinding.bind(popupImplView)
        val layoutParams = binding.root.layoutParams
        layoutParams.width = ScreenUtils.getScreenWidth() - SizeUtils.dp2px(30f)
        binding.root.layoutParams = layoutParams
        binding.tvTitle.text = title
        binding.tvContent.text = content
    }

}